-
-
Notifications
You must be signed in to change notification settings - Fork 131
fix: 🐛 remove double-width characters correctly #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks, this looks good. Can you add a test? |
Are there any examples for reference? |
Good question -- I guess we don't really do tests in this crate. Ignore my question! |
src/utils.rs
Outdated
|
||
#[cfg(feature = "ansi-parsing")] | ||
fn char_width(c: char) -> usize { | ||
pub fn char_width(c: char) -> usize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to make this pub
, please fold the not(feature = "ansi-parsing")
variant into this function (which I think happens implicitly anyway?) and add a docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't consider it carefully. I have now made this function pub(crate).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you don't need it in dialoguer anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you don't need it in dialoguer anymore?
I can add unicode_width
crate in dialoguer.
(If you rebase on main, CI should pass.) |
Signed-off-by: 刘洋 <[email protected]> Signed-off-by: bestgopher <[email protected]>
Bumps console from 0.15.10 to 0.15.11. Release notes Sourced from console's releases. 0.15.11 What's Changed Don't eagerly close tty fd in read_secure by @Noratrieb in console-rs/console#222 Make functions on Style const by @tamird in console-rs/console#220 Fix some typos by @waywardmonkeys in console-rs/console#213 Improve type safety, extract identical code by @tamird in console-rs/console#223 Unix tweaks by @djc in console-rs/console#230 Fix WASI target name by @djc in console-rs/console#236 Simplify & update by @djc in console-rs/console#237 fix: 🐛 remove double-width characters correctly by @bestgopher in console-rs/console#234 Explicitly handle CtrlC on Windows by @ericmarkmartin in console-rs/console#235 Windows mode tweaks by @djc in console-rs/console#239 Commits c7002e3 Refer to GitHub Releases 73033ec Bump version to 0.15.11 4fa21ad Simplify windows read_single_key() 456eb78 Remove unused cruft 8623cd6 Simplify ConsoleModeGuard::set() ca2e0f8 Use match for creation of new console mode 2f7184f Add docstring for Windows set_console_mode() 3c7ba95 Explicitly handle CtrlC on Windows (#235) de16ee6 Run clippy on all major platforms cb6126e Extend application of clippy Additional commits viewable in compare view Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase. Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: @dependabot rebase will rebase this PR @dependabot recreate will recreate this PR, overwriting any edits that have been made to it @dependabot merge will merge this PR after your CI passes on it @dependabot squash and merge will squash and merge this PR after your CI passes on it @dependabot cancel merge will cancel a previously requested merge and block automerging @dependabot reopen will reopen this PR if it is closed @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
No description provided.